var __extends =
    (this && this.__extends) ||
    (function () {
      var t = function (e, o) {
        return (t =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (t, e) {
              t.__proto__ = e;
            }) ||
          function (t, e) {
            for (var o in e)
              Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
          })(e, o);
      };
      return function (e, o) {
        function n() {
          this.constructor = e;
        }
        if ("function" != typeof o && null !== o)
          throw new TypeError(
            "Class extends value " + String(o) + " is not a constructor or null"
          );
        t(e, o),
          (e.prototype =
            null === o
              ? Object.create(o)
              : ((n.prototype = o.prototype), new n()));
      };
    })(),
  MatchOtherDialog = (function (t) {
    function e() {
      var e = t.call(this) || this;
      return (
        (e.waiting = !0),
        (e.second = 0),
        e.btn_wait.on(Laya.Event.CLICK, e, e.okButtonDidClick),
        e.btn_quit.on(Laya.Event.CLICK, e, e.quitButtonDidClick),
        (e.closeHandler = new Handler(e, e.onCloseMatchFn)),
        e
      );
    }
    return (
      __extends(e, t),
      (e.prototype.okButtonDidClick = function () {
        this.okMethod.call(this.caller);
      }),
      (e.prototype.quitButtonDidClick = function () {
        this.quitMethod.call(this.caller),
          Laya.timer.clear(this, this.refreshState);
      }),
      (e.showMatchNormalDialog = function (t, o, n, i) {
        null == this.normal &&
          ((this.normal = new e()), (this.normal.zOrder = 1e3)),
          this.normal.popup(!0),
          (this.normal.btn_wait.disabled = !0),
          (this.normal.label_match_content.text = t),
          (this.normal.caller = o),
          (this.normal.okMethod = n),
          (this.normal.quitMethod = i),
          (this.normal.waiting = !1),
          (this.normal.second = 60),
          (this.normal.waiting = !0),
          Laya.timer.loop(1100, this.normal, this.normal.refreshState);
      }),
      (e.prototype.onCloseMatchFn = function () {
        Laya.timer.clear(this, this.refreshState);
      }),
      (e.closeMatch = function () {
        this.normal.close(Dialog.CANCEL),
          Laya.timer.clear(this.normal, this.normal.refreshState);
      }),
      (e.prototype.refreshState = function () {
        this.second--,
          (this.label_match_content.text =
            "正在匹配对手(" + this.second + "s)..."),
          (this.btn_wait.disabled = !0),
          0 == this.second &&
            ((this.label_match_content.text = "未匹配到对手"),
            Laya.timer.clear(this, this.refreshState),
            (this.btn_wait.disabled = !1));
      }),
      (e.prototype.close = function (o) {
        ("side" == o && e.normal) ||
          (Laya.timer.clear(this, this.refreshState),
          t.prototype.close.call(this, o));
      }),
      e
    );
  })(ui.ChallengeBattle.MatchOtherDialogUI);
